import { createRouter, createWebHistory } from "vue-router";

import IndexView from "@/views/index/index.vue";
import ClazzView from "@/views/clazz/index.vue";
import DeptView from "@/views/dept/index.vue";
import EmpView from "@/views/emp/index.vue";
import LogView from "@/views/log/index.vue";
import StuView from "@/views/stu/index.vue";
import EmpReportView from "@/views/report/emp/index.vue";
import StuReportView from "@/views/report/stu/index.vue";
import AssetInventoryReportView from "@/views/report/asset/index.vue";
import LayoutView from "@/views/layout/index.vue";
import LoginView from "@/views/login/index.vue";
import RepairView from "@/views/repair/index.vue";
import RepairTypeView from "@/views/repair/type.vue";
import RepairDetailView from "@/views/repair/detail.vue";
import AssetView from "@/views/asset/index.vue";
import AssetCategoryView from "@/views/asset/category.vue";
import AssetAttachmentView from "@/views/asset/attachment.vue";
import AssetAssignmentView from "@/views/asset/assignment.vue";
import AssetTransferView from "@/views/asset/transfer.vue";
import AssetInventoryView from "@/views/asset/inventory.vue";
import AssetInventoryDetailView from "@/views/asset/inventoryDetail.vue";
import AssetReportView from "@/views/asset/report.vue";
import RepairReportView from "@/views/repair/report.vue";
import RepairEffectivenessReportView from "@/views/repair/effectivenessReport.vue";
import RepairWorkerReportView from "@/views/repair/workerReport.vue";
import RepairCreateView from "@/views/repair/create.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "",
      component: LayoutView,
      redirect: "/index", //重定向
      children: [
        { path: "index", name: "index", component: IndexView },
        { path: "clazz", name: "clazz", component: ClazzView },
        { path: "stu", name: "stu", component: StuView },
        { path: "dept", name: "dept", component: DeptView },
        { path: "emp", name: "emp", component: EmpView },
        { path: "log", name: "log", component: LogView },
        { path: "empReport", name: "empReport", component: EmpReportView },
        { path: "stuReport", name: "stuReport", component: StuReportView },
        // 资产盘点统计页面
        { path: "assetInventoryReport", name: "assetInventoryReport", component: AssetInventoryReportView },
        { path: "repair", name: "repair", component: RepairView },
        { path: "repairType", name: "repairType", component: RepairTypeView },
        { path: "repairDetail", name: "repairDetail", component: RepairDetailView },
        { path: "asset", name: "asset", component: AssetView },
        { path: "assetCategory", name: "assetCategory", component: AssetCategoryView },
        { path: "assetAttachment", name: "assetAttachment", component: AssetAttachmentView },
        { path: "assetAssignment", name: "assetAssignment", component: AssetAssignmentView },
        { path: "assetTransfer", name: "assetTransfer", component: AssetTransferView },
        { path: "assetInventory", name: "assetInventory", component: AssetInventoryView },
        { path: "assetInventoryDetail", name: "assetInventoryDetail", component: AssetInventoryDetailView },
        { path: "assetReport", name: "assetReport", component: AssetReportView },
        { path: "repairReport", name: "repairReport", component: RepairReportView },
        { path: "repairEffectivenessReport", name: "repairEffectivenessReport", component: RepairEffectivenessReportView },
        { path: "repairWorkerReport", name: "repairWorkerReport", component: RepairWorkerReportView },
        { path: "repairCreate", name: "repairCreate", component: RepairCreateView },
        // 住宿管理相关页面
        { path: "accommodation/building", name: "accommodationBuilding", component: () => import("@/views/accommodation/building/index.vue") },
        { path: "accommodation/room", name: "accommodationRoom", component: () => import("@/views/accommodation/room/index.vue") },
        { path: "accommodation/bed", name: "accommodationBed", component: () => import("@/views/accommodation/bed/index.vue") },
        { path: "accommodation/accommodation", name: "accommodationAccommodation", component: () => import("@/views/accommodation/accommodation/index.vue") },
        { path: "accommodation/report", name: "accommodationReport", component: () => import("@/views/accommodation/report/index.vue") },
      ],
    },
    { path: "/login", name: "login", component: LoginView },
  ],
});

export default router;
